package com.lu.statistics.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lu.statistics.entity.MtWeddingPhotographers;
import com.lu.statistics.mapper.MtWeddingPhotographersMapper;
import com.lu.statistics.service.WeddingPhotographersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WeddingPhotographersServiceImpl extends ServiceImpl<MtWeddingPhotographersMapper, MtWeddingPhotographers> implements WeddingPhotographersService {
    @Autowired
    private MtWeddingPhotographersMapper photographersMapper;

    @Override
    public IPage<MtWeddingPhotographers> queryPagePhotographers(String choiceType, int current, int pageSize) {
        Page<MtWeddingPhotographers> page = new Page(current, pageSize);
        QueryWrapper<MtWeddingPhotographers> wrapper = new QueryWrapper<>();
        if (choiceType != null) {
            wrapper.eq("choice_type", choiceType);
        }
        wrapper.orderBy(true, false, "create_time");
        return photographersMapper.selectPage(page, wrapper);
    }
}
